package com.jvmoutofmemory.octopus.model;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

public class FileModel {
    /**
     * 已打印
     */
    public static final int status_printed = 1;
    /**
     * 未打印
     */
    public static final int status_unprint = 0;

    public static String[] titles = new String[]{"文件名", "修改时间", "打印状态"};

    private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");

    private File file;

    private String status;

    private String name;

    private String filepath;

    private String updateTime;

    private int statusCode;

    public FileModel() {
        this.statusCode = status_unprint;
    }

    public FileModel(File file) {
        this.file = file;
        this.status = "等待打印";
        this.filepath = file.getAbsolutePath();
        this.name = file.getName();
        this.updateTime = simpleDateFormat.format(new Date(file.lastModified()));
        this.statusCode = status_unprint;
    }

    public String[] toRowData() {
        return new String[]{name, updateTime, status};
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getFilepath() {
        return filepath;
    }

    public void setFilepath(String filepath) {
        this.filepath = filepath;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
}
